#ifndef _ACTIONQUEUE_H_
#define _ACTIONQUEUE_H_

#include <misc.h>
#include <Widget.h>
#include "gamecore.h"
#include <SDL/SDL.h>

using namespace animationagent;

enum ActionType
{
    ACTION_MOVE,
    ACTION_SET_POSITION,
    ACTION_SHOW,
    ACTION_HIDE,
    ACTION_FADE_IN,
    ACTION_FADE_OUT,
    ACTION_SETCOLOR,
    ACTION_SETTEXT,
    ACTION_PLAYCARD,
    ACTION_DRAWCARD,
    ACTION_DISCARDCARD,
    ACTION_LOCKCONTROL,
    ACTION_UNLOCKCONTROL
};

struct ActionNode
{
    Uint32 timestamp;
    int type;
    union {
        struct {
            Widget *widget;
            Uint32 duration;
            Sint16 x;
            Sint16 y;
        }movment;
        struct {
            Widget *widget;
            Uint32 duration;
        }fade;
        const char *str;
        struct {
            Uint8 r, g, b;
        }color;
        struct {
            GameCore::PlayerID player;
            Sint16 index;
        }cardaction;
    }param;
};

class ActionQueue
{
public:
    ActionQueue();
    ~ActionQueue();
    void action_push(ActionNode *node);
    ActionNode *action_poll();
    bool empty();

private:
    misc::SimpleList<ActionNode *> actionlist;
};

#endif //_ACTIONQUEUE_H_
